#ifndef __CBASE_LBM_INFO__
#define __CBASE_LBM_INFO__

#include <atomic>
#include <unordered_map>
#include "tinyxml.h"
#include "IUtility.h"
#include "IPacket.h"
#include "IDataConnect.h"

class CBaseLbmInfo : public virtual ILbm, public virtual IProductInstance
{
INIT_CLASS_PRODUCT(CBaseLbmInfo)
public:
	const bool Init(const void * pvdPara, char * pszMsgTxt, int iMsgTxtSize);
	const char * LbmNo();
	const bool CompareFlg();
	const bool NullFlg();
	void * ParaInfo();
	const char * PktType();
	const char * FixCodeByName(const char * pszFixCode);
	const char * NameByFixCode(const char * pszName);
	const char * DataTypeByName(const char * pszFixCode);
	const char * DataTypeByFixCode(const char * pszName);
	const int Interval();
	const bool SynFlg();
	const char * SplitFieldName();
	const char * UpdTimeFiledName();
	const char * GroupFieldName();
	const bool BeforPost(void * ptrTask) override;
	const void InitRunInfo();
	const void SetRunInfo(long long llRunTime, long long llRunDuration);
	const void GetRunInof(void * ptrPktRestul);
private:
	shared_ptr<IPacket> m_ptrParaInfo;
	shared_ptr<IStrFun> m_ptrStrFun;
	shared_ptr<ISysFun> m_ptrSysFun;
	atomic<long long> m_llBgnTime, m_llEndTime, m_llCallCount, m_llDuration, m_llMaxTime;
	atomic_flag m_Flg;

private:
	bool LoadLbmInfo(const void * pvdPara);
	char *m_szLbmNo, *m_szSplitFieldName, *m_szUpdTimeFiledName, *m_szGroupFieldName, *m_szPktType;
	bool m_bCompareFlg, m_bNullFlg, m_bSynFlg;
	int m_iInterval;
	unordered_map<string, string> m_mpFixCode2Name, m_mpName2FixCode, m_mpDataTypeByName, m_mpDataTypeByFixCode;
};

#endif//__CBASE_LBM_INFO__